package lbframework.classe;

import lbframework.gui.ProgressBarGUI;

public class ProgressBar {

    private static ProgressBarGUI form = null;

    public static void show() throws Exception {
        form = new ProgressBarGUI();

        Thread thread = new Thread() {

            @Override
            public void run() {
                form.setVisible(true);
            }
        };

        thread.start();
    }

    public static void setStatus(String s) throws Exception {
        form.setStatus(s);
    }

    public static void setMaximum(int n) throws Exception {
        form.setMaximum(n);
        form.clear();
    }

    public static void next() throws Exception {
        form.next();
    }

    public static void dispose() {
        try {
            while (form.isDisplayable()) {
                form.dispose();
                Thread.sleep(100);
            }

        } catch (Exception ex) {
        }
    }

    public static void setCancel(boolean aCancel) {
        form.setCancel(aCancel);
    }

    public static void setIndeterminate(boolean aIndeterminate) {
        form.setIndeterminate(aIndeterminate);
    }

    public static void setPause(boolean aPause) {
        form.setPause(aPause);
    }

}